#ifndef MISCUTILS_H
#define MISCUTILS_H

#include <stdint.h>
#include <visibility.h>

__EXPORT void Stepper(float *curVal, float newVal, const float step);
__EXPORT float Stepper2(float curVal, float newVal, const float step);

// limit value with the [min..max] range
template <typename T>
__EXPORT T limit(T value, T minValue, T maxValue) {
	if (value > maxValue)
		return maxValue;
	else if (value < minValue)
		return minValue;
	return value;
}

template <typename T>
__EXPORT T min(T x, T y) {
	return (x < y) ? x : y;
}

template <typename T>
__EXPORT T max(T x, T y) {
	return (x > y) ? x : y;
}


#endif

